
$(document).ready(function() {


    // 商品列表
    function table1(id, url) {
        $(id).DataTable({
            data: url, //待改 ajax
            //scrollY: 500, //滚动条
            bLengthChange: false,//不显示条数
            "initComplete": function () {           //双击搜索
                var api = this.api();
                api.$('td').dblclick( function () {
                    api.search( this.innerHTML ).draw();
                } );
            },
            columns: [
                {data: "商品ID"},
                {data: "商品名称"},
                {data: "商品编号"},
                {data: "商品图片."},
                {data: "商品品牌"},
                {data: "商品分类"},
                {data: "备注"},
                {data: "操作"}
            ]
        });
    }

    table1("#example", dataSet);
    // 商品品牌
    $("#example2").DataTable({
        data: dataSet2, //待改 ajax
        //scrollY: 500, //滚动条
        bLengthChange: false,//不显示条数
        "initComplete": function () {           //双击搜索
            var api = this.api();
            api.$('td').dblclick( function () {
                api.search( this.innerHTML ).draw();
            } );
        },
        columns: [
            {data: "商品ID"},
            {data: "商品品牌"},
            {data: "商品图片."},
            {data: "备注"},
            {data: "操作"}
        ]
    });
    // 商品分类
    $("#example3").DataTable({
        data: dataSet3, //待改 ajax
        //scrollY: 500, //滚动条
        bLengthChange: false,//不显示条数
        "initComplete": function () {           //双击搜索
            var api = this.api();
            api.$('td').dblclick( function () {
                api.search( this.innerHTML ).draw();
            } );
        },
        columns: [
            {data: "商品ID"},
            {data: "商品分类名称"},
            {data: "商品图片."},
            {data: "操作"}
        ]
    });
});


